import { ReactNode } from 'react';

import { Quote, ToolModuleResponseItemType } from '@/pages/app-qa/components/chat/tools/constants';

export interface ThinkItem {
  title: string;
  description?: string;
  status?: string;
  id?: string;
}

export interface ChatItem {
  text?: string;
  isUser: boolean;
  loading?: boolean;
  loadingText?: string;
  isSurvey?: boolean;
  isTextGenerate?: boolean;
  chatId?: string;
  dataId?: string;
  appName?: string;
  appId?: string;
  shareId?: string;
  appLogo?: string;
  appType?: string;
  userGoodFeedback?: string;
  userBadFeedback?: string;
  quote?: Quote[];
  thinkList?: ThinkItem[];
  toolJson?: Record<string, ToolModuleResponseItemType>;
  interactive?: {
    type: string;
    params: {
      column?: number;
      description: string;
      defaultValue: string;
    };
  };
  params?: {
    inputForm?: Array<{
      type: string;
      key: string;
      label: string;
      description?: string;
      value?: string | number | string[];
      defaultValue?: string | number | string[];
      valueType: string;
      required: boolean;
      list?: Array<{
        label: string;
        value: string;
        children?: Array<{
          label: string;
          value: string;
          children?: Array<{
            label: string;
            value: string;
          }>;
        }>;
      }>;
    }>;
  };
}

export interface ThoughtChainItemType {
  label: ReactNode;
  children: ReactNode;
  key: string;
}

export type ThoughtChainItem = ThoughtChainItemType[];

export interface Message {
  text: string;
  isUser: boolean;
  loading?: boolean;
  loadingText?: string;
  chatId?: string;
  dataId?: string;
  ts?: number;
  quote?: Quote[];
  isSurvey?: boolean;
  isTextGenerate?: boolean;
  toolJson?: Record<string, ToolModuleResponseItemType>;
}

export interface ChatEvent {
  type: ChatEventType;
  data: any;
}

export enum ChatEventType {
  SENDTEXT,
}
